﻿using UnityEngine;

public class SkeletonAttackState : SkeletonStateBase
{
    public SkeletonAttackState(ControllerBase controller, StateMachineBase stateMachine, string stateName,
        string animatorParameter = null) : base(controller, stateMachine, stateName, animatorParameter)
    {
    }
    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
        SelfController.lastAttackTime = Time.time;
    }

    public override void Update()
    {
        base.Update();
        
        if (triggerFinish)
        {
            stateMachine.ChangeState(Setting.battle);
            return;
        }
        /*if (target.position.x>SelfController.transform.position.x)
        {
            SelfController.FlipController(1);
        }else if (target.position.x<SelfController.transform.position.x)
        {
            SelfController.FlipController(-1);
        }*/
        
        SelfController.SetVelocity(Vector2.zero);
    }
}